//
//  QuadraticCurve.m
//  bezierPath
//
//  Created by Andrew on 2018/7/25.
//  Copyright © 2018年 Andrew. All rights reserved.
//  二次曲线

#import "QuadraticCurve.h"

@implementation QuadraticCurve

- (void)drawRect:(CGRect)rect
{
    //创建一条贝塞尔
    UIBezierPath *aPath = [UIBezierPath bezierPath];
    
    //宽度
    aPath.lineWidth = 5.0;
    //线条拐角
    aPath.lineCapStyle = kCGLineCapRound;
    //终点处理
    aPath.lineJoinStyle = kCGLineJoinRound;
    
    //起始点
    [aPath moveToPoint:CGPointMake(20, 100)];
    //添加两个控制点
    [aPath addQuadCurveToPoint:CGPointMake(220, 100) controlPoint:CGPointMake(170, 0)];
    
    //可以加多个控制点
//    [aPath addQuadCurveToPoint:CGPointMake(300, 400) controlPoint:CGPointMake(300, 0)];
    //划线
    [aPath stroke];
}

@end
